/*
 * BinaryDivOperatorAst.cpp
 *
 *  Created on: 30 Oct 2010
 *      Author: kn308
 */

#include <MAlice/Ast/BinaryDivOperatorAst.h>

namespace MAlice
{

BinaryDivOperatorAst::BinaryDivOperatorAst(ExpressionAst* lhs,
		ExpressionAst* rhs) :
	BinaryOperatorAst("/", lhs, rhs)
{
}

BinaryDivOperatorAst::~BinaryDivOperatorAst()
{
}

llvm::Value* BinaryDivOperatorAst::generate()
{
	Value* LHS = getLHS()->generate();
	Value* RHS = getRHS()->generate();

	checkType(LHS, RHS);

	Builder* builder = MAlice::Codegen::get()->getBuilder();

	return builder->CreateSDiv(LHS, RHS);
}
}
